<table>
<?php foreach($this->params as $val):?>
<tr>
<?php
$data = $val->attributes();
$type = strtolower($data['type']);

$param_name = (string)$data['name'];
if (isset($this->param_data[$param_name]))
	$default = $this->param_data[$param_name];
else
	$default = (string)$data['default'];
?>
<th><?php echo  $param_name?>
<br/><?php echo  $data['label']?></th>
<td>
<?php switch($type):?>
<?php case 'text':?>
<input type="text" name="<?php echo  $data['name']?>" value="<?php echo  $default?>" />
<?php break; ?>
<?php case 'radio':?>
<?php foreach($val->option as $option):?>
<input type="radio" name="<?php echo  $data['name']?>" value="<?php echo  $option->value?>"
<?php if ($default == (string)$option->value):?> checked="checked"<?php endif?>
 /> <label><?php echo  $option->display?></label> &nbsp;
<?php endforeach?>
<?php break; ?>
<?php case 'select':?>
<select name="<?php echo  $data['name']?>" >
<?php foreach($val->option as $option):?>
<option  value="<?php echo  $option->value?>"
<?php if ($default == (string)$option->value):?> selected<?php endif?>>
<?php echo  $option->display?></option>
<?php endforeach?>
</select>
<?php break; ?>

<?php endswitch; ?>
</td>
</tr>
<?php endforeach?>
</table>
<?php if ($this->params):?>
<input type="hidden" name="resource_id" value="<?php echo  $this->id?>" /> 
<p style="width:95%;text-align:right"><input type="submit" name="act" value="設定" /></p>
<?php else:?>
<h2>無參數可設定</h2>
<?php endif?>